package com.lzq.FactoryPattern;

public class Factory_Simple {
    public static void main(String[] args) {
    }
    //抽象产品
    public interface Product {
        void show();
    }
    //具体产品：Product01
    static class Product01 implements Product {
        public void show() {
            System.out.println("生产产品1");
        }
    }
    //具体产品：Product02
    static class Product02 implements Product {
        public void show() {
            System.out.println("生产产品2");
        }
    }
    final class Const {
        static final int PRODUCT_A = 0;
        static final int PRODUCT_B = 1;
        static final int PRODUCT_C = 2;
    }
    public static class SimpleFactory {
        public static Product makeProduct(int kind) {
            switch (kind) {
                case Const.PRODUCT_A:
                    return new Product01();
                case Const.PRODUCT_B:
                    return new Product02();
            }
            return null;
        }
    }
}
